<template>
  <div>
    <!-- 顶部滑动条区域 -->
    <div id="slider" class="mui-slider">
      <div
        id="sliderSegmentedControl"
        class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted"
      >
        <div class="mui-scroll">
          <a
            :class="['mui-control-item', i == 0 ? 'mui-active' : '']"
            v-for="(item, i) in cates"
            :key="i"
          >{{item.title}}</a>
        </div>
      </div>
    </div>

    <!-- 图片区域 -->
    <ul>
      <router-link v-for="(item, i) in list" :key="i" :to="'/home/photoinfo/' + i" tag="li">
        <img v-lazy="item.url" />
        <div class="info">
          <h1 class="info-title">{{item.title}}</h1>
          <div class="info-body">{{item.content}}</div>
        </div>
      </router-link>
    </ul>
  </div>
</template>

<script>
import mui from "../../lib/mui/js/mui.min.js";
//初始化滑动工具

export default {
  data() {
    return {
      cates: [
        { title: "全部" },
        { title: "体育" },
        { title: "游戏" },
        { title: "推荐" },
        { title: "健身" },
        { title: "户外" },
        { title: "旅游" }
      ],
      list:[
        {url: "https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=2846450048,758809783&fm=26&gp=0.jpg", title: "内容1", content: "这是内容"},
        {url: "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2966612801,1137255602&fm=26&gp=0.jpg", title: "内容1", content: "这是内容"},
        {url: "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1518631979,542540857&fm=26&gp=0.jpg", title: "内容1", content: "这是内容"},
        {url: "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=308317503,2558338935&fm=26&gp=0.jpg", title: "内容1", content: "这是内容"},
        {url: "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2191725128,2952090680&fm=26&gp=0.jpg", title: "内容1", content: "这是内容"},

      ]
    };
  },
  methods: {
    // getPhotoListByCateId() {
    //   this.$http.get('http://route.showapi.com/2020-1').then(result => {
    //     // if (result.body.status === 0) {
    //       console.log(result);
          
    //     // }
    //   })
    // }
  },
  // created() {
  //   this.getPhotoListByCateId()
  // },
  mounted() {
    mui(".mui-scroll-wrapper").scroll({
      deceleration: 0.0005 //flick 减速系数，系数越大，滚动速度越慢，滚动距离越小，默认值0.0006
    });
  }
};
</script>

<style scoped>
*{
  list-style: none;
}
.mui-slider {
  touch-action: pan-x;
}

ul{
  margin: 0;
  padding:10px;
}
ul li{
  background-color: #ccc;
  text-align: center;
  margin-bottom: 10px;
  box-shadow: 0 0 9px #999;
  position: relative;
}
ul li img{
  width: 100%;
}
image[lazy=loading] {
  width: 40px;
  height: 300px;
  margin: auto;
}
.info{
color:#fff;
text-align: left;
position: absolute;
bottom: 0;
background-color: rgba(0, 0, 0, .4);
max-height: 84px;
width: 100%;
}
.info-title{
font-size: 14px;
}
.info-body{
font-size: 13px;
}
</style>
